<?php

namespace app\mobile\controller;

use think\Controller;
use think\Db;
use Myredis\Myredis;
use think\Request;

class Details extends Controller
{
    public function index()
    {
        $gid=input('gid');
        if (empty($gid)) {
            return $this->redirect('index/error/index');
        }
        $res =Db::table('xo_goods_up')->where(['id'=>$gid])->field(true)->find();
        $res['size'] = round($res['size'] / 1024, 2);
        $username = Db::table('xo_user')->where(['id'=>$res['uid']])->field('nickname')->find();
        $look = Myredis::hincrby('look', $gid, '1');
        $attencount = Db::table('xo_user_goods')->where(['id'=>$gid])->count();
        return view('index',[
            'res'=>$res,
            'username'=>$username['nickname'],
            'look'=>$look,
            'attencount'=>$attencount
        ]);
    }
}
